Skip to content

Support latest tplink Archer D9 Firmware version / Device Scanner#15356

Merged
MartinHjelmare merged 4 commits intohome-assistant:devfrom
JackNova:tplink-archer-d9-latest-firmware-support
Jul 17, 2018
Merged

Support latest tplink Archer D9 Firmware version / Device Scanner#15356
MartinHjelmare merged 4 commits intohome-assistant:devfrom
JackNova:tplink-archer-d9-latest-firmware-support

Conversation

@JackNova
Copy link
Copy Markdown
Contributor

@JackNova JackNova commented Jul 8, 2018

Description:

Support latest tplink Archer D9 Firmware version / Device Scanner

Related issue (if applicable): fixes #

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#5808

Example entry for configuration.yaml (if applicable):

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@homeassistant
Copy link
Copy Markdown
Contributor

Hi @JackNova,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments here #11827.

Device integration should be done using a pypi package.

@JackNova
Copy link
Copy Markdown
Contributor Author

JackNova commented Jul 8, 2018

ok

@fabaff fabaff mentioned this pull request Jul 9, 2018
1 task
@JackNova
Copy link
Copy Markdown
Contributor Author

I just migrated my integration in a pypi package, the idea is to gradually migrate there all the other integrations

"""
from tplink.tplink import TpLinkClient
_LOGGER.info("Loading wireless clients...")
client = TpLinkClient(
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare Jul 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to create a new client on each update?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea is that on home assistant the client should be just one. Current clients should be gradually migrated on the tplink package. I migrated the one I own and could test

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but on this line a new client instance is created each time the device tracker scans for new devices. That seems possibly unessecary to me. Would it work to create the client in init method, save the client as an instance attribute, and reuse the same client instance on each update?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, seems a reasonable request.

@JackNova JackNova closed this Jul 16, 2018
@ghost ghost removed the in progress label Jul 16, 2018
@JackNova JackNova reopened this Jul 16, 2018
@ghost ghost added the in progress label Jul 16, 2018
def __init__(self, config):
"""Initialize the scanner."""
from tplink.tplink import TpLinkClient
self.host = config[CONF_HOST]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since host isn't used outside this method we can cache it in a local variable, instead of an instance attribute.

"""Initialize the scanner."""
from tplink.tplink import TpLinkClient
self.host = config[CONF_HOST]
self.password = config[CONF_PASSWORD]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

from tplink.tplink import TpLinkClient
self.host = config[CONF_HOST]
self.password = config[CONF_PASSWORD]
self.username = config[CONF_USERNAME]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks, I'll refactor

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@MartinHjelmare
Copy link
Copy Markdown
Member

Please add a link to a docs PR in the description of this PR. Then we can merge.

@JackNova
Copy link
Copy Markdown
Contributor Author

@MartinHjelmare I'm not sure I got it.

@MartinHjelmare
Copy link
Copy Markdown
Member

I meant that you should create a new PR that updates our docs and says what additional model of router is supported.

Ie this page:
https://www.home-assistant.io/components/device_tracker.tplink/

@JackNova
Copy link
Copy Markdown
Contributor Author

Ok. Sure. Thanks

@JackNova
Copy link
Copy Markdown
Contributor Author

done

@MartinHjelmare MartinHjelmare merged commit 4ab502a into home-assistant:dev Jul 17, 2018
@ghost ghost removed the in progress label Jul 17, 2018
@JackNova JackNova deleted the tplink-archer-d9-latest-firmware-support branch July 18, 2018 04:23
@balloob balloob mentioned this pull request Aug 3, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Dec 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants